Fix another GtkFixed regression, in gtk_fixed_forall()
authorMatthias Clasen <mclasen@redhat.com>
Wed, 2 Feb 2011 05:40:02 +0000 (00:40 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 2 Feb 2011 05:40:02 +0000 (00:40 -0500)
b3f6f67c changed the loop from while() to for() in gtk_fixed_forall(),
but that's wrong since the callback can have side-effects on the list,
in case the current child gets removed. And that's the case when the
widget is destroyed.

Patch by Vincent Untz
https://bugzilla.gnome.org/show_bug.cgi?id=641196

gtk/gtkfixed.c

index fd92cd7b2efa6a47c412b4adf33067c2d344707f..e4530058e86cc452e46e733678f994b314eb6eb3 100644 (file)
@@ -540,9 +540,11 @@ gtk_fixed_forall (GtkContainer *container,
   GtkFixedChild *child;
   GList *children;
 
-  for (children = priv->children; children; children = children->next)
+  children = priv->children;
+  while (children)
     {
       child = children->data;
+      children = children->next;
 
       (* callback) (child->widget, callback_data);
     }